<template>
	<view class="magic-card">
		<view class="magic-card-item">
			<view class="header">
				<image class="img-icon" src="/static/image/diamond.png" mode="widthFix"></image>
				<view class="content" @click="$util.redirectTo('/magicpages/coin_record/coin_record')">
					<text class="header-title">我的星钻</text>
					<view class="header-des">
						<text>交易记录</text>
						<text class="iconfont1 icon-jiantou1 arrow-right-icon"></text>
					</view>
				</view>
			</view>
			<view class="bottom">
				<text class="price" @click="$util.redirectTo('/magicpages/coin_record/coin_record')">{{coin}}</text>
				<button class="button" type="defalut"
					@click.stop="$util.redirectTo('/magicpages/account_charge/account_charge')">购买</button>
			</view>
		</view>
		<view class="magic-card-item">
			<view class="header">
				<image class="img-icon" src="/static/image/packet.png" mode="widthFix"></image>
				<view class="content" @click="$util.redirectTo('/magicpages/free_box/free_box')">
					<text class="header-title">免费福袋</text>
					<view class="header-des">
						<text>查看详情</text>
						<text class="iconfont1 icon-jiantou1 arrow-right-icon"></text>
					</view>
				</view>
			</view>
			<view class="bottom">
				<text class="price" @click="$util.redirectTo('/magicpages/free_box/free_box')">{{freeboxNum}}</text>
				<button class="button" type="defalut"
					@click.stop="$util.redirectTo('/magicpages/free_box/get_free_box')">获取</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			coin: {
				type: String,
				default: '0.00'
			},
			freebox: {
				type: [String,Number],
				default: '0'
			}
		},
		computed: {
			freeboxNum() {
				return this.freebox > 0? this.freebox: 0;
			}
		}
	}
</script>

<style lang="scss" scoped>
	.magic-card {
		background: #FFFFFF;
		border-radius: 21rpx;
		display: flex;
		padding: 33rpx 28rpx;
		box-sizing: border-box;

		.magic-card-item {
			width: 50%;
			display: flex;
			flex-direction: column;
			padding: 5rpx 0;
			box-sizing: border-box;

			&:first-of-type {
				padding-right: 28rpx;
				border-right: 1px solid #DADADA;
			}

			&:last-of-type {
				margin-left: 28rpx;
			}

			.header {
				display: flex;

				&>image {
					width: 69rpx;
					height: 69rpx;
					margin-right: 18rpx;
				}

				.content {
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.header-title {
						color: #333333;
						font-size: 26rpx;
						line-height: 26rpx;
						font-family: Source Han Sans CN;
						font-weight: 500;
					}

					.header-des {
						color: #999999;
						font-size: 22rpx;
						line-height: 22rpx;

						.arrow-right-icon {
							color: #999999;
							font-size: 22rpx;
							margin-left: 14rpx;
						}
					}
				}

			}

			.bottom {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 45rpx;

				.price {
					font-size: 35rpx;
					line-height: 27rpx;
					color: #444444;
					font-family: Source Han Sans CN;
					font-weight: bold;
				}

				.button {
					width: 98rpx;
					height: 47rpx;
					line-height: 47rpx;
					font-size: 22rpx;
					background: linear-gradient(90deg, #6185FF, #8B60FF);
					border-radius: 24rpx;
					color: #FFFFFF;
					padding: 0;
					margin: 0;
				}
			}
		}

	}
</style>
